// pages/databaseGuide/databaseGuide.js

const app = getApp()


Page({
    data: {
        value: 0,
        defValue:63,
        styles: {
            line: '#dbdbdb',
            bginner: '#fbfbfb',
            bgoutside: '#fff',
            lineSelect: '#52b8f5',
            font: '#404040'
        }
    },
    bindvalue: function (e) {
        // console.log(e)
        this.setData({
            value: e.detail.value
        })
    },
    addWeight(){
        console.log("选中体重",this.data.value)
        wx.cloud.callFunction({
            name: 'addHealthData_rdl',
            data: {
                weight:this.data.value
            },
        }).then((res) => {
            console.log('[云函数] [addHealthData_rdl] : ', res)
            let detail = { res: res} // detail对象，提供给事件监听函数
            let option = {} // 触发事件的选项
            //调用父组件
            this.triggerEvent('afterAddWeight', detail,option) //myevent 自定义名称事件，父组件中使用
        })
    },
    close(){
        this.triggerEvent('afterAddWeight', {},{}) //myevent 自定义名称事件，父组件中使用
    }


})
